home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / T U R B O Language / Turbo C Tools v6.0 / INCLUDE / BHELP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  8.9 KB  |  267 lines

  1. /**
  2. *
  3. *  BHELP.H    Header file for Turbo C TOOLS Help Functions
  4. *
  5. *  Version    6.00 (C)Copyright Blaise Computing Inc.  1988
  6. *
  7. **/
  8.  
  9.  
  10. #ifndef DEF_BHELP          /* Prevent redefinition.        */
  11. #define DEF_BHELP   1
  12.  
  13. #include <bwindow.h>
  14.  
  15.  
  16. #define HL_ID_SIZE        13
  17. #define HL_SIGN_SIZE         7
  18.  
  19.  
  20. /********************************************************************/
  21. /* Definitions of data types.                        */
  22. /********************************************************************/
  23.  
  24.         /* The types HL_WINDOW and HL_RECORD_DATA MUST        */
  25.         /* match each other field for field from view_top   */
  26.         /* to highlight_back, inclusive.            */
  27.  
  28. typedef struct
  29. {
  30.     int  view_top;        /* Top edge of viewport.        */
  31.     int  view_left;        /* Left edge of viewport.        */
  32.     int  view_bottom;        /* Bottom edge of viewport.        */
  33.     int  view_right;        /* Right edge of viewport.        */
  34.     int  origin_row;        /* Data area coordinates initially  */
  35.     int  origin_col;        /*   appearing in viewport's origin.*/
  36.     int  data_fore;        /* Data area foreground color.        */
  37.     int  data_back;        /* Data area background color.        */
  38.     int  border_type;        /* Viewport border type.        */
  39.     int  border_fore;        /* Border foreground color.        */
  40.     int  border_back;        /* Border background color.        */
  41.     int  title_type;        /* Window title.            */
  42.     int  title_fore;        /* Title Foreground.            */
  43.     int  title_back;        /* Title Background.            */
  44.     int  data_rows;        /* # rows in image.            */
  45.     int  data_columns;        /* # columns in image.            */
  46.     int  xref_fore;        /* Foreground/background attributes */
  47.     int  xref_back;        /*   for cross reference items.     */
  48.     int  highlight_fore;    /* Foreground/background attributes */
  49.     int  highlight_back;    /*   for highlight bar.         */
  50.     char *pwindow_title;    /* Text of window title.        */
  51. } HL_WINDOW;
  52.  
  53. /**
  54. *
  55. *   Database structure: the actual format of the help database is as
  56. *   follows:
  57. *
  58. *   +----------------+ \
  59. *   |             |    |
  60. *   | HL_FILE_HEADER |     >  Required file header record.
  61. *   |             |    |
  62. *   +----------------+ /
  63. *
  64. *   +----------------+ \
  65. *   |             |    |
  66. *   | HL_RECORD_DATA |    |
  67. *   |             |    |
  68. *   +----------------+    |
  69. *   +----------------+    |
  70. *   |             |    |   0 or more help window records with
  71. *   |  Screen Image  |     >  compressed screen images and optional
  72. *   |             |    |   window titles.
  73. *   +----------------+    |
  74. *   ..................    |
  75. *   :             :    |
  76. *   :  Window Title  :    |
  77. *   :             :    |
  78. *   :................: /
  79. *
  80. *        :
  81. *        :
  82. *
  83. *   +----------------+ \
  84. *   |             |    |
  85. *   | HL_INDEX_DATA  |    |
  86. *   |             |    |
  87. *   +----------------+    |   Index records with optional description
  88. *   ..................     >  strings.  Each help window record has
  89. *   :             :    |   exactly one index record associated with it.
  90. *   :  Description   :    |
  91. *   :     String      :    |
  92. *   :             :    |
  93. *   :................: /
  94. *
  95. *        :
  96. *        :
  97. *
  98. **/
  99.  
  100.  
  101. typedef struct
  102. {
  103.     char      file_sign[20];    /* Identifying text.        */
  104.     char      text_terminator;  /* Control Z (#26).         */
  105.     char      reserved;        /* Reserved.            */
  106.     unsigned      version;        /* database version number.     */
  107.     unsigned long index_offset;     /* Position of the index.        */
  108.     unsigned long file_size;        /* Size of the file.        */
  109. } HL_FILE_HEADER;
  110.  
  111.  
  112. #define HL_WINDOW_RECORD    0
  113. #define HL_INDEX_RECORD     1
  114.  
  115. #define HL_FILE_SIGN        "Blaise Computing Inc"
  116. #define HL_VERSION        0x0100
  117.  
  118. typedef struct
  119. {
  120.     unsigned type;            /* Type of database record.     */
  121.     unsigned length;            /* Length of following record.  */
  122. } HL_RECORD_ID;
  123.  
  124.  
  125. typedef struct
  126. {
  127.     HL_RECORD_ID record_sign;    /* Record header.            */
  128.     char id_string[HL_ID_SIZE]; /* ID of help record.            */
  129.     char     reserved;        /* Reserved.                */
  130.     int      view_top;        /* Top edge of viewport.        */
  131.     int      view_left;     /* Left edge of viewport.        */
  132.     int      view_bottom;    /* Bottom edge of viewport.        */
  133.     int      view_right;    /* Right edge of viewport.        */
  134.     int      origin_row;    /* Data area coordinates initially  */
  135.     int      origin_col;    /*   appearing in viewport's origin.*/
  136.     int      data_fore;     /* Data area foreground color.        */
  137.     int      data_back;     /* Data area background color.        */
  138.     int      border_type;    /* Viewport border type.        */
  139.     int      border_fore;    /* Border foreground color.        */
  140.     int      border_back;    /* Border background color.        */
  141.     int      title_type;    /* Window title.            */
  142.     int      title_fore;    /* Title Foreground.            */
  143.     int      title_back;    /* Title Background.            */
  144.     int      data_rows;     /* # rows in image.            */
  145.     int      data_columns;    /* # columns in image.            */
  146.     int      xref_fore;     /* Foreground/background attributes */
  147.     int      xref_back;     /*   for cross reference items.     */
  148.     int      highlight_fore;    /* Foreground/background attributes */
  149.     int      highlight_back;    /*   for highlight bar.         */
  150.     unsigned title_length;    /* Window title length.         */
  151.     unsigned image_length;    /* Screen image length.         */
  152. } HL_RECORD_DATA;
  153.  
  154.  
  155. typedef struct
  156. {
  157.     HL_RECORD_ID  record_sign;        /* Record header.            */
  158.     char      id_string[HL_ID_SIZE]; /* ID of help record.        */
  159.     char      reserved;        /* Reserved.            */
  160.     unsigned long help_record;        /* File offset of help record.  */
  161.     unsigned long xref_list;        /* Cross reference list offset. */
  162.     unsigned      description_len;  /* Length of decription string. */
  163.     unsigned long next_index;        /* Offset of next index record. */
  164. } HL_INDEX_DATA;
  165.  
  166.  
  167. typedef struct help_index_node
  168. {
  169.     HL_INDEX_DATA        index_data;
  170.     char           *pdescription;
  171.     struct help_index_node *pleft;
  172.     struct help_index_node *pright;
  173. } HL_INDEX_NODE;
  174.  
  175.  
  176. /********************************************************************/
  177. /* User Macros.                             */
  178. /********************************************************************/
  179.  
  180.         /* Option codes for HLREAD and HLLOOKUP.        */
  181. #define HL_CHARS_ONLY        CHARS_ONLY
  182. #define HL_CHAR_ATTR        CHAR_ATTR
  183. #define HL_COMPRESSED        0x40
  184. #define HL_REMOVE_WIN        0x10
  185. #define HL_DESTROY_WIN        0x30
  186. #define HL_KBIGNORE        (WN_KBIGNORE)
  187. #define HL_USE_MOUSE        (WN_USE_MOUSE)
  188. #define HL_NO_MOUSE        (WN_NO_MOUSE)
  189.  
  190. #define HL_TEXT_TYPE    (HL_CHARS_ONLY | HL_CHAR_ATTR | HL_COMPRESSED)
  191.  
  192.  
  193. /********************************************************************/
  194. /* Global variables.                            */
  195. /********************************************************************/
  196.  
  197. extern HL_WINDOW      b_def_help_win;
  198. extern char          b_help_path[];
  199. extern HL_INDEX_NODE *b_phelp_index;
  200.  
  201.  
  202. /********************************************************************/
  203. /* Error codes.                             */
  204. /********************************************************************/
  205.  
  206. #define HL_NO_ERROR        (WN_NO_ERROR)
  207. #define HL_NO_MEMORY        (WN_NO_MEMORY)
  208. #define HL_ILL_DIM        (WN_ILL_DIM)
  209. #define HL_NO_EXIT        (WN_NO_EXIT)
  210. #define HL_BAD_OPT        (WN_BAD_OPT)
  211. #define HL_NO_PATH        200
  212. #define HL_NO_HANDLES        201
  213. #define HL_BAD_DATABASE     202
  214. #define HL_NO_INDEX        203
  215. #define HL_NOT_FOUND        204
  216. #define HL_VER_MISMATCH     205
  217. #define HL_SYSTEM        206
  218.  
  219.  
  220. /********************************************************************/
  221. /* User function declarations.                        */
  222. /********************************************************************/
  223.  
  224. int      cdecl hlopen(const    /* Open a help database and        */
  225.                char *); /* construct its index in memory.   */
  226.                 /*                    */
  227. int      cdecl hlclose(void);    /* Close the help database.        */
  228.                 /*                    */
  229. WN_EVENT *cdecl hlread(     /* Display a help window and accept */
  230.           BWINDOW *,    /* user responses.            */
  231.           const     /*                    */
  232.             HL_WINDOW *,/*                    */
  233.           const char *, /*                    */
  234.           int,        /*                    */
  235.           WN_EVENT *,    /*                    */
  236.           int);     /*                    */
  237.                 /*                    */
  238. int      cdecl hllookup(    /* Look up the help text and window */
  239.           const char *, /* information for a help record.   */
  240.           const char *, /*                    */
  241.           unsigned long,/*                    */
  242.           HL_WINDOW  *, /*                    */
  243.           char **,int *,/*                    */
  244.           int);     /*                    */
  245.                 /*                    */
  246. WN_EVENT *cdecl hldisp (    /* Look up help info, display it in */
  247.           const char *, /* a help window and accept user    */
  248.           const char *, /* responses.                */
  249.           unsigned long,/*                    */
  250.           WN_EVENT *,    /*                    */
  251.           int);     /*                    */
  252.                 /*                    */
  253.  
  254.  
  255. /********************************************************************/
  256. /* Internal function declarations and macros.                */
  257. /********************************************************************/
  258.  
  259. void      cdecl hlfrindx(HL_INDEX_NODE *);
  260. int      cdecl hlpas2c(const char *, char *, int);
  261.  
  262. #define hlerror(error)    wnerror(error)
  263. #define hlreterr(error) wnreterr(error)
  264.  
  265.  
  266. #endif                /* Ends "#ifndef DEF_BHELP"         */
  267.